#include "socket_class.hpp"
#include "connection.hpp"
#include "network.hpp"
#include "tcp_link.hpp"
#include "io.hpp"
#include <iostream>
using std::cout;
using std::endl;



void test()
{

    rocket::connection client(10086,"127.0.0.1");
    client.connect_server();
    rocket::tcp_link link(client.get_fd());
    cout<<"server linked"<<endl;

    rocket::packet data(1,strlen("10"),"10");
    data.print();
    rocket::tlv tlv(data.get_type(),data.get_length(),data.get_data().c_str()); 

    int ret1=link.send_tlv(tlv);
    cout<<"send_tlv :"<<ret1<<":";
    tlv.print();


    rocket::packet data2;
    int ret=link.read_packet(data);

    cout<<"receive :"<<ret<<":"<<endl;
    data.print();
}



int main()
{
    test();
    return 0;
}

